$(function(){
    var couponId = location.href.split('?')[1].split('=')[1];
    $.ajax({
        url: "http://193.112.55.79:9090/api/getcouponproduct",
        data: {
            couponid: couponId
        },
        type: "get",
        dataType: "json",
        success: function (res) {
            var htmlStr2 = template("templ2", {data: res.result});
            var htmlStr3 = template("templ3", {data: res.result});
            $(".coupon_list ul")[0].innerHTML = htmlStr2;
            $(".my_swiper .swiper-wrapper")[0].innerHTML = htmlStr3;
            // 轮播图
            var swiper = new Swiper('.swiper-container', {
                nextButton: '.swiper-button-next',
                prevButton: '.swiper-button-prev',
                paginationType: 'fraction',
            }); 
        }
    });

    $(".coupon_ul").on('tap', '.coupon_li', function(event){
        $(".my_swiper")[0].classList.remove("lunbotu_hidden");
    });
    $(".my_swiper").on('tap', function(event){
        this.classList.add("lunbotu_hidden");
    });
    $(".swiper-container").on('tap', function(event){
        event.stopPropagation();
    });

});